package com.example.mappeer;

import com.example.pojo.Emp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: EmpMapper
 * Package: com.example.mappeer
 * Description:
 *
 * @Author liu
 * @Create 2025/5/25 21:01
 * @ Version 1.0
 */

@Mapper
public interface EmpMapper {
    //原始方法：
    /**
     * 查询总记录数
     */
//    @Select("select count(*) from emp e left join dept d on e.dept_id = d.id ")
//    public Long count();
//
//    /**
//     * 查询所有的员工及其对应的部门名称
//     */
//    @Select("select e.*, d.name deptName from emp as e left join dept as d on e.dept_id = d.id limit #{start}, #{pageSize}")
//    public List<Emp> list(Integer start , Integer pageSize);

    //推荐方法：
    //不用写分页参数
   
    @Select("select e.*, d.name deptName from emp as e left join dept as d on e.dept_id = d.id")
    public List<Emp> list();
}
